package com.hjc.springbootmovies.mapper;

import com.hjc.springbootmovies.entity.ModelFsort;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: HJC
 * Date: 2019/12/4
 * Time: 17:58
 * To change this template use File | Settings | File Templates.
 */
@Mapper
public interface MappingFsort {

    @Select("select sid,sname,sremark from fsort")
    List<ModelFsort> queryFsort();

    @Select("SELECT * FROM fsort WHERE sid=#{sid}")
    ModelFsort queryById(int sid);

    @Insert("INSERT INTO fsort(sname,sremark) VALUES (#{sname},#{sremark})")
    @Options(useGeneratedKeys = true , keyProperty = "sid")
    int addFsort(ModelFsort modelFsort);

    @Delete("DELETE FROM fsort WHERE sid=#{sid} ")
    int deleteById(int sid);

    @Update("UPDATE fsort SET sname = #{sname} ,sremark = #{sremark} WHERE sid=#{sid} ")
    int updateFsort(ModelFsort modelFsort);
}
